package com.lxl.workbench.service.impl;

import com.lxl.commons.mapper.IMapper;
import com.lxl.commons.mapper.impl.BookMapperImpl;
import com.lxl.workbench.dao.BookDao;
import com.lxl.workbench.dao.BookDaoImpl;
import com.lxl.workbench.entity.Book;
import com.lxl.workbench.service.BookService;

import javax.servlet.jsp.jstl.sql.Result;
import java.sql.SQLException;
import java.util.List;

/**
 * @author 北上寻海
 */
public class BookServiceImpl  implements BookService {
    BookDao bookDao = new BookDaoImpl();
    IMapper bookMapper = new BookMapperImpl();
    @Override
    public List<Book> selectBookByCondition(String bookName, String bookType, String bookAuthor) throws SQLException {
        return bookMapper.mapper(bookDao.selectBookByCondition(bookName,bookType,bookAuthor));
    }



    @Override
    public List<Book> selectBookByIds(String[] ids) throws SQLException {
        return  bookMapper.mapper(bookDao.selectBookByIds(ids));
    }

    @Override
    public int updateBookByIds(String[] ids, int[] remainingArray) throws SQLException {
        return bookDao.updateBookByIds(ids,remainingArray);
    }

    @Override
    public int insertBook(Book book) throws SQLException {
        return bookDao.insertBook(book);
    }

    @Override
    public int updateBookByCondition(Book book) throws SQLException {
        return  bookDao.updateBookByCondition(book);
    }

    @Override
    public int deleteBookByIds(String[] delIds) throws SQLException {
        return bookDao.deleteBookByIds(delIds);
    }
}
